package com.neuedu.service.impl;

import com.neuedu.dao.AddDeptmentDao;
import com.neuedu.dao.DeptClassityDao;
import com.neuedu.dao.TableDao;
import com.neuedu.factory.ClassFactory;
import com.neuedu.service.DeptClassityService;

import java.util.List;
import java.util.Map;

public class DeptClassityServiceImpl implements DeptClassityService {
    @Override
    public List<Map<String, Object>> getAllDeptClassity() {
        DeptClassityDao dcd= (DeptClassityDao) ClassFactory.createObj("DeptClassityDao");
        String sql = "SELECT * FROM deptclassify;";
        return  dcd.getAllDeptClassity(sql);
    }

    @Override
    public int delClassify(Object[] objs) {
        DeptClassityDao dcd = (DeptClassityDao) ClassFactory.createObj("DeptClassityDao");
        int flag=dcd.delclassify(objs);
        return flag;
    }

    @Override
    public int addClassify(Object[] objs) {
        DeptClassityDao dcd= (DeptClassityDao) ClassFactory.createObj("DeptClassityDao");
        return dcd.addClassify(objs);
    }

    @Override
    public int updateClassify(Object[] objs) {
        DeptClassityDao dcd= (DeptClassityDao) ClassFactory.createObj("DeptClassityDao");
        return dcd.updateClassify(objs);
    }

    @Override
    public List<Map<String, Object>> likeQuery(Object[] objs) {
        DeptClassityDao dcd = (DeptClassityDao) ClassFactory.createObj("DeptClassityDao");
        String sql = "SELECT * FROM deptclassify where classifyname like ? OR id like ?";
        return  dcd.getLikeDeptClassity(sql,objs);
    }

}
